import { defineStore } from 'pinia'
import LocalService from '@/service/local'
import { SideMenu } from '@xuekl/cli-base/type'
import { setFullPath } from '@/utils'

const localService = new LocalService()

const useLocal = defineStore('localStore', {
    state(): { menus: SideMenu[] } {
        return {
            menus: [],
        }
    },
    actions: {
        async initMenus() {
            const data = await localService.getMenus({})
            this.menus = setFullPath(data)
        }
    }
})

export default useLocal